package com.qpx.redis.controller;


import com.qpx.redis.service.RedisLockTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisLockController {

    @Autowired
    RedisLockTest redisLockTest;

    @Autowired
    StringRedisTemplate stringRedisTemplate;
    @RequestMapping("/lock/test")
    public String  test() throws InterruptedException {
        stringRedisTemplate.delete("order1");
        redisLockTest.setNx();
        return "ok";
    }
}
